import mongoose from 'mongoose'
import {createUid} from "creality-utils";
const configItemSchema = new mongoose.Schema({
    name: {
        type: String,
        required: true,
    },
    jointName: {
        type: String,
        required: true,
    },
    startAngle: {
        type: Number,
        required: true,
    },
    endAngle: {
        type: Number,
        required: true,
    },
    second: {
        type: Number,
        required: true,
    },

});
// thressjs表
const schema = new mongoose.Schema({
    id: {
        type: String,
        default: () => createUid(),// 唯一id
    },
    // 配置名称
    name: {
      type: String,
      required: true,
      unique: false
    },
    // 备注
    remarks: {
      type: String,
      required: false,
      unique: false
    },
    // createTime: {
    //     type: Number,
    //     default: new Date().getTime(),
    // },
    configInfo: [configItemSchema],
}, {
    // 日期
    timestamps: {
        createdAt: 'createTime',
        updatedAt: 'updateTime'
    }
})

export default mongoose.model('controlList', schema)
